$(document).ready(function() {
		
		$('#branding > a').slideUp('slow');
		
		$('input[name=edit]').bind('click', function() {
			//alert($(this).val());
			if ($(this).val()=='0') { 
				$('#div-title').show();
				$('#div-location').show();
			}
			else {
				$('#div-title').hide();
				$('#div-location').hide();
			}
		});
		
		$('input[name=email]').bind('change', function() {
				wtfaq.putLoader($(this));
				$.ajax({url: wtfaq.pad +'user.php',
						data: '&email='+$('input[name=email]').val(),
						dataType: 'json',
						success: wtfaq.callbackUser_0,
						error: wtfaq.cleanUp
					});

		});

		$('input[name=token]').bind('change', function() {	
				wtfaq.putLoader($(this));
				$.ajax({url: wtfaq.pad+'user.php',
						data: '&email='+$('input[name=email]').val() + '&token='+$('input[name=token]').val(),
						dataType: 'json',
						success: wtfaq.callbackUser_1,
						error: wtfaq.cleanUp
					});

		});
		
		$('input[name=button-wtfaq]').bind('click', wtfaq.sendForm);
		$('input[name=button-question-next]').bind('click', wtfaq.sendFormQuestion);
		$('input[name=button-question-end]').bind('click', function() { document.location = '?logout'} );

		if (Modernizr.geolocation) {
			navigator.geolocation.getCurrentPosition(wtfaq.tellLocation);
		}
		else {
			alert("geolocation not supported; we can't be at your service.");
			// geolocation is not supported in this browser
		}

});

